// 上次启动时的用户信息
let userId = uni.getStorageSync('userId') || '';
let userInfo = uni.getStorageSync('userInfo');
let state = {
		//是否已经登录
		hasLogin: Boolean(userId),
		//用户信息
		userInfo: userInfo,
		scene:''
		
	},
	getters = {
		info(state) {
			return state.info;
		},
		hasLogin(state){
			return state.hasLogin;
		}
	},
	mutations = {
		SET_USERINFO(state,info){
			// state.hasLogin = true;
			// console.log(info)
			// console.log('info.userId',info.id)
			// console.log(Boolean(info.id))
			if(info.id){
				state.hasLogin = true;
			}
			state.userInfo = info
			uni.setStorageSync('userInfo', state.userInfo);
		},
		SET_SCENE(satate,scene){
			satate.scene = scene
		}
		// login(state, info) { //登录成功后的操作
		// 	//原有的结合传来的参数
		// 	let _info = state.info;
		// 	state.info = Object.assign({}, _info, info);
		// 	//设置为已经登录
		// 	state.hasLogin = true;
		// 	console.log('state.info',state.info);
		// 	//存储最新的用户数据到本地持久化存储
		// 	uni.setStorageSync('userInfo', state.info);
		// 	if(info.token){
		// 		uni.setStorage({
		// 			key: 'uni_id_token',
		// 			data: state.info.token,
		// 			complete(e){
		// 				// console.log('setStorage-------',e);
		// 			}
		// 		});
		// 		uni.setStorageSync('uni_id_token_expired', state.info.tokenExpired)
		// 	}
		// }
	},
	actions = {
	}
export default {
	namespaced: true,
	state,
	getters,
	mutations,
	actions
}